home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4241 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.4 KB

  1. Path: news.compuserve.com!newsmaster
  2. From: <75151.03563@compuserve.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: RE:MFC ::OnIdle()
  5. Date: 29 Jan 1996 07:06:12 GMT
  6. Organization: CompuServe Incorporated
  7. Message-ID: <4ehrl4$km5@dub-news-svc-2.compuserve.com>
  8. NNTP-Posting-Host: hd83-010.compuserve.com
  9. Content-Type: text/plain
  10. Content-length: 1056
  11. X-Newsreader: AIR Mosaic (16-bit) version 3.10.08.25
  12.  
  13.  
  14. >> I need to do constant background processing in an MFC Visual C++ 
  15. >> application...
  16. >> I overrode the CWinApp function ::OnIdle() to this...
  17. >> It works fine except when a Modal Dialog is popped up... OnIdle() is never called
  18. >>
  19.  
  20. MFC implements the OnIdle() functionality in the Message Loop that it implements 
  21. for its applications.  When there are no messages waiting, it calls the OnIdle() 
  22. function.  When you have a Modal Dialog popped up, the MFC message loop is
  23. not being called.  Modal Dialogs use a Windows supplied message loop in USER.EXE
  24. that knows nothing about MFC (or its message loop).  That is why your OnIdle() 
  25. function is not being called while a modal dialog is up.
  26.  
  27. If you need constant, regular backgrond processing, you have a better option
  28. than using OnIdle().
  29.  
  30.   Set up a timer.  You can start a timer and have it send a WM_TIMER message
  31. to your window at regular intervals.  These message will keep coming even when
  32. you have a modal dialog up.
  33.  
  34. Hope this helps,
  35.  
  36. Tom Keane
  37. 75151.03563@compuserve.com
  38.  
  39.  
  40.